#ifndef MYWIDGET_H
#define MYWIDGET_H
#include <QWidget>
#include <QVector>
#include "mylabel.h"
#include "mybutton.h"
class MyWidget:public QWidget
{
public:
    MyWidget(QWidget* parent = nullptr);
    virtual ~MyWidget();
    void AddBtn(ButtonInfo* info,int x = 0,int y = 0);
    void AddLabel(LabelInfo* info,int x = 0,int y = 0);
    QString name;
    QString bgPath;
    void SetButton(ButtonInfo* info);
    void SetLabel(LabelInfo* info);
    //删除选中的控件
    void DeleteSelected();
    virtual void RefreshBg(QString path);
    QVector<MyLabel*> GetLabels();
    QVector<MyButton*> GetButtons();
    void PushLabel(MyLabel* l);
    void PushButton(MyButton* b);
    void SetLayout(LAYOUT layout);
    LAYOUT myLayout = NONE_LAYOUT;
public slots:
    void DeleteChild(QString name);
protected:
    virtual void dragEnterEvent(QDragEnterEvent *event);
    virtual void dropEvent(QDropEvent *event);
    void resizeEvent(QResizeEvent *event);
private:
    ButtonInfo* btn = nullptr;
    LabelInfo* label = nullptr;
    QVector<MyLabel*> labels;
    QVector<MyButton*> btns;
};

#endif // MYWIDGET_H
